package org.example.com.util;

import lombok.Data;

import java.io.Serializable;

@Data
public class JsonResult<T> implements Serializable {
    private Boolean success;//true or false
    private T data;//正确返回
    private Integer code;//状态码
    private String error;//错误返回信息
    public JsonResult(){

    }
    public JsonResult(T data){
        this.data = data;
        this.success = true;
        this.code = 200;
    }
    public JsonResult(Integer code, String error) {
        this.success = false;
        this.code = code;
        this.error = error;
    }
}
